#include<stdio.h>
#include<stdlib.h>
#include<string.h>

char * d[] = {          "zero", "one", "two", "three", "four", 
                      "five", "six", "seven", "eight", "nine"};

int get_map(char * p)
{
    if(strcmp(p, "zero") == 0)
                 return 0;
    if(strcmp(p, "one") == 0)
                 return 1;
    if(strcmp(p, "two") == 0)
                 return 2;
    if(strcmp(p, "three") == 0)
                 return 3;
    if(strcmp(p, "four") == 0)
                 return 4;
    if(strcmp(p, "five") == 0)
                 return 5;
    if(strcmp(p, "six") == 0)
                 return 6;
    if(strcmp(p, "seven") == 0)
                 return 7;
    if(strcmp(p, "eight") == 0)
                 return 8;
    if(strcmp(p, "nine") == 0)
                 return 9;
}

int main()
{
    char expr[100] = {0};
    
    while(1)
    {
            int num1 = 0;
            int num2 = 0;
            
            int second = 0;
            memset(expr, 0, sizeof(char)*100);
            do
            {
                 scanf("%s", expr);
                 if(strcmp(expr, "+") == 0)
                 {
                     second = 1;
                     continue;
                 }
                 else if(strcmp(expr, "=") == 0)
                      break;
                 
                 if(second == 0)
                 {
                        num1 = (num1 << 3) + (num1 << 1);
                        num1 += get_map(expr);
                 }
                 else
                 {
                        num2 = (num2 << 3) + (num2 << 1);
                        num2 += get_map(expr);   
                 }
                         
            }while(strcmp(expr, "=") != 0);
            
            if(num1 == 0 && num2 == 0)
                    break;
            else
                    printf("%d\n", num1 + num2);
    }    
    
    return 0;
}

/***************************************************/
/*
	what I learned:
	scanf("%d", str) can only get a non-empty string once a time. the string will stop when met with a white space.
****************************************************/	